package com.dingreading.cloud.admin.util;

import com.dingreading.cloud.admin.entity.CmactivationCode;
import com.dingreading.cloud.admin.entity.CmactivationCodeLog;
import com.dingreading.cloud.admin.entity.StoreFunction;
import com.dingreading.cloud.common.util.KitUtil;

public class AdminEntityUtils {
    public static StoreFunction addEntity(
            StoreFunction storeFunction, String headStaffUid, String headStaffName, String name, String identify, Integer status
    ) {
        if (storeFunction == null) {
            storeFunction = new StoreFunction();
            storeFunction.setUid(KitUtil.getUuid());
            storeFunction.setEnabled(1);
            storeFunction.setAddStaffUid(headStaffUid);
            storeFunction.setAddStaffName(headStaffName);
        }
        storeFunction.setName(name);
        storeFunction.setIdentify(identify);
        storeFunction.setStatus(status);
        storeFunction.setLastStaffUid(headStaffUid);
        storeFunction.setLastStaffName(headStaffName);
        return storeFunction;
    }

    public static CmactivationCode addCmactivationCode(
            String headStaffUid, String headStaffName, String activationTypeUid, String activationName,
            Double amount, String corpUid, String storeUid, String storeName
    ) {
        CmactivationCode code = new CmactivationCode();
        code.setActivationCode(KitUtil.getActivationCode());
        code.setActivationTypeUid(activationTypeUid);
        code.setActivationTypeName(activationName);
        code.setActivationTypeAmount(amount);
        code.setCorpUid(corpUid);
        code.setStoreUid(storeUid);
        code.setStoreName(storeName);
        code.setStatus(0);
        code.setSource(0);
        code.setAddStaffUid(headStaffUid);
        code.setAddStaffName(headStaffName);
        code.setLastStaffUid(headStaffUid);
        code.setLastStaffName(headStaffName);
        return code;
    }

    public static CmactivationCodeLog addCmactivationCodeLog(
            String headStaffUid, String headStaffName, String activationTypeUid, String activationName,
            Long codeNum, String corpUid, String storeUid, String storeName
    ) {
        CmactivationCodeLog cmactivationCodeLog = new CmactivationCodeLog();
        cmactivationCodeLog.setUid(KitUtil.getUuid());
        cmactivationCodeLog.setActivationTypeUid(activationTypeUid);
        cmactivationCodeLog.setActivationTypeName(activationName);
        cmactivationCodeLog.setActivationNum(codeNum.intValue());
        cmactivationCodeLog.setCorpUid(corpUid);
        cmactivationCodeLog.setStoreUid(storeUid);
        cmactivationCodeLog.setStoreName(storeName);
        cmactivationCodeLog.setAddStaffUid(headStaffUid);
        cmactivationCodeLog.setAddStaffName(headStaffName);
        return cmactivationCodeLog;
    }
}
